@model Article
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ArticleWrapper prevArt = ViewBag.PrevSibling;
    ArticleWrapper nextArt = ViewBag.NextSibling;
    IEnumerable<Article> relatedArticles = ViewBag.RelateArticles;
    var article = new ArticleWrapper(Model);
}

<table style="width: 100%;">
    <tr>
        <td colspan="2" style="padding-right: 10px; text-align: right;">
            @Ajax.ImageToggleButton(new ImageToggleButtonOptions()
                                                        {
                                                            ImageUrl = Url.Content("~/Content/Images/sidebar_close.gif"),
                                                            ToggleImageUrl = Url.Content("~/Content/Images/sidebar_open.gif"),
                                                            Text = Html.Global("publishing", "HideSidebar"),
                                                            ToggleText = Html.Global("publishing", "ShowSidebar"),
                                                            OnClientClick = "$('#readerSidebar').fadeOut('normal');$('#readerContent').css('width','100%');",
                                                            OnClientToggleClick = "$('#readerSidebar').fadeIn('normal');$('#readerContent').css('width','700px');",
                                                            ImageStyleText = "float:right;margin-left:5px;padding-top:2px;",
                                                            TextStyleText = "float:right;"
                                                        })
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top;width: 700px;display:block;" id="readerContent">
            @{ Html.RenderPartial("ViewContent", Model); }
            @if (!string.IsNullOrEmpty(Model.SendTrackbackUrls))
            {
                if (article.GetSendTrackbackUrls().Count() == 1)
                { 
                <ul class="d-horizontal-list">
                    <li>
                        @Ajax.Dna().Link("javascript:void(0);").LocText("publishing", "References").ImageIcons(Url.Content("~/Content/Images/reference.gif")).GetHtml()
                    </li>
                    <li><a href="@article.SendTrackbackUrls" rel="nofollow"  target="_blank">@article.SendTrackbackUrls</a>
                    </li>
                </ul>
                }
                else
                { 
                @Ajax.Dna().Link("javascript:void(0);").LocText("publishing", "References").ImageIcons(Url.Content("~/Content/Images/reference.gif")).GetHtml()
                <blockquote style="clear: left;">
                    <ul class="ui-helper-reset">
                        @{var quoteUrls = article.GetSendTrackbackUrls();}
                        @foreach (var quoteUrl in quoteUrls)
                        {
                            <li><a href="@quoteUrl" target="_blank">
                                @quoteUrl</a></li>
                        }
                    </ul>
                </blockquote>
                }
            }
            <table style="padding: 5px 0px 5px 0px; width: 100%;">
                <tr>
                    <td style="width: 50%">
                        @if (prevArt != null)
                        {
                            @Ajax.Dna().Link(prevArt.PermaLink).Text(Html.Global("publishing", "PreviousPost") + ":" + prevArt.GetGlobalizationContent().Title).ImageIcons(Url.Content("~/Content/Images/icon_back_16.png")).GetHtml()
                        }
                    </td>
                    <td style="text-align: right">
                        @if (nextArt != null)
                        {
                            @Ajax.Dna().Link(nextArt.PermaLink).Text(Html.Global("publishing", "NextPost") + ":" + nextArt.GetGlobalizationContent().Title).ImageIcons("",Url.Content("~/Content/Images/icon_next_16.png")).GetHtml()
                        }
                    </td>
                </tr>
            </table>
            @Publishing.ShareTo(article)
            @if (!string.IsNullOrEmpty(Model.RelatedPosts))
            {
                <div style="margin-left: 5px; overflow: auto; padding: 5px 5px 5px 0;">
                    <b>@Html.Global("publishing","RelatedArticles"):</b></div>
                foreach (var ra in relatedArticles)
                {
                <div style="clear: left; padding: 5px;">
                    @Html.ImageLink(ra.Title, ra.PermaLink, Url.Content("~/Content/Images/relatedpost.gif"))
                </div>
                }
            }
            @if (Model.AllowComments)
            {
                <div id="commentlist">
                    @{Html.RenderPartial("Comments", Model); }
                </div>
            }
        </td>
        <td style="vertical-align: top;" id="readerSidebar">
            @{ Ajax.Dna().WidgetZone("Right banner", "RightZone").Render(); }
        </td>
    </tr>
</table>
@Html.StartupScripts()
@section HeaderSection{
    @if (Model.AllowComments)
    {
        <link rel="alternate" type="application/rss+xml" href="@Url.Action("Rss", "Article", new
                                                          {
                                                              Area = "Publishing",
                                                              website = WebSiteContext.Current.Web.Name,
                                                              id = Model.ID
                                                          })" title="@(Model.Title + " Comments Feed")" />
        <link rel="alternate" type="application/atom+xml" href="@Url.Action("Atom", "Article", new
                                                           {
                                                               Area = "Publishing",
                                                               website = WebSiteContext.Current.Web.Name,
                                                               id = Model.ID
                                                           })" title="@(Model.Title + " Comments Feed")" />
    }
    @if (Model.AllowPingback)
    {
        <link href="@(UrlResolver.Resolve(WebSiteContext.Current.Web) + Url.Content("~/xmlrpc.ping"))" rel="pingback" />
    }
}
